﻿using StaffingSystem.Business;
using StaffingSystem.EF;
using StaffingSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace StaffingSystem.Controllers
{
    public class TransferEmpController : Controller
    {
        #region 员工提交申请
        JsonResult result;
        // GET: TransferEmp
        public ActionResult TransferAdd()
        {
            return View();
        }
        [HttpPost]
        public ActionResult TransferAdd(TransferEmpView TR)
        {
            result = new JsonResult();
            Management db = new Management();
            Personnelinfor list = new Personnelinfor();
            Transfer er = new Transfer();
            Loginon user = Session["JobNumber"] as Loginon;
            er.JobNumber = user.JobNumber;//登陆用户的jobnumber
            er.Type = Convert.ToInt32(TR.Type);
            er.Reason = TR.Reason;

            if (list.TransferADD(er) > 0)
            {
                result = DataHelper.GetResult(ExecuteState.Succeed, "添加成功！", "");
            }
            else
            {
                result = DataHelper.GetResult(ExecuteState.Failed, "添加失败！", "");
            }
            return result;
        }
        #endregion

    }
}